import request from '@/utils/request'

const carsApi = {
  lists: '/api/v2/scooters'
}

export function getCarsLists (paramter) {
  return request({
    url: carsApi.lists,
    method: 'get',
    params: paramter
  })
}

export function getCar (id) {
  return request({
    url: carsApi.lists + '/' + id,
    method: 'get'
  })
}

export function addCar (id, data) {
  // {
  //   "name": "测试车辆", // string: 名称
  //   "photo": "http://example.com/example.jpg" // string(url): 照片
  // }
  return request({
    url: carsApi.lists + '/' + id,
    method: 'post',
    data
  })
}

export function putCar (id, data) {
  // {
  //   "name": "测试车辆", // string: 名称
  //   "photo": "http://example.com/example.jpg" // string(url): 照片
  // }
  return request({
    url: carsApi.lists + '/' + id,
    method: 'put',
    data
  })
}
